/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ipcc.utility.controller;

import com.ipcc.utility.entity.IPCC_SESSION;
import com.ipcc.utility.model.IPCC_SESSIONModel;
import java.io.Serializable;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;

/**
 *
 * @author Administrator
 */
@ViewScoped
public class IPCC_SESSIONController implements Serializable{
    private String user_id;
    private String callgroup;
    private String effective_caller_id_name;
    private String effective_caller_id_number;
    private String contact_status;
    private String last_updated;
    private DataModel items;
    private IPCC_SESSION current;
    private int timeRe = 10;
    /**
     * Creates a new instance of IPCC_SESSIONController
     */
    public IPCC_SESSIONController() {
        try{
            items = new ListDataModel(IPCC_SESSIONModel.getAll(""));
        }
        catch(Exception e){
            e.printStackTrace();
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("ERROR: "+e.getMessage()));
        }
    }

    public int getTimeRe() {
        return timeRe;
    }

    public void setTimeRe(int timeRe) {
        this.timeRe = timeRe;
    }

    public String getUser_id() {
        return user_id;
    }

    public void setUser_id(String user_id) {
        this.user_id = user_id;
    }

    public String getCallgroup() {
        return callgroup;
    }

    public void setCallgroup(String callgroup) {
        this.callgroup = callgroup;
    }

    public String getEffective_caller_id_name() {
        return effective_caller_id_name;
    }

    public void setEffective_caller_id_name(String effective_caller_id_name) {
        this.effective_caller_id_name = effective_caller_id_name;
    }

    public String getEffective_caller_id_number() {
        return effective_caller_id_number;
    }

    public void setEffective_caller_id_number(String effective_caller_id_number) {
        this.effective_caller_id_number = effective_caller_id_number;
    }

    public String getContact_status() {
        return contact_status;
    }

    public void setContact_status(String contact_status) {
        this.contact_status = contact_status;
    }

    public String getLast_updated() {
        return last_updated;
    }

    public void setLast_updated(String last_updated) {
        this.last_updated = last_updated;
    }

    public DataModel getItems() {
        return items;
    }

    public void setItems(DataModel items) {
        this.items = items;
    }

    public IPCC_SESSION getCurrent() {
        return current;
    }

    public void setCurrent(IPCC_SESSION current) {
        this.current = current;
    }
        
    public void reload(){
        try{
            items = new ListDataModel(IPCC_SESSIONModel.getAll(""));
        }
        catch(Exception e){
            e.printStackTrace();
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("ERROR: "+e.getMessage()));
        }
    }
}
